<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>信息上报 | 高校健康云</title>
        <header th:replace="header::html"></header>

        <link rel="stylesheet" th:href="@{/my/css/report.css}" />
        <style>
            /*@media (max-width: 400px) {*/

            /*}*/
        </style>

    </head>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="/">首页</a>
            <a>
                <cite>信息上报</cite></a>
          </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
                <i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </div>

        <div class="layui-fluid">
            <div class="layui-row  layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form report-form">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">
                                        <!--<span class="x-red">*</span>-->个人体温情况
                                    </label>

                                    <div class="form-temperature layui-input-block">
                                        <input type="radio" th:field="${sysReport.temperature}" name="travel"  th:each="c:${reportDict['temperature']}" th:value="${c.dictKey}" th:title="${c.dictValue}" >
                                    </div>
                                </div>

                                <div class="layui-form-item" id="physicalCondition">
                                    <label for="L_email" class="layui-form-label">
                                        <!--<span class="x-red">*</span>-->是否有下列情况？（可多选）
                                    </label>
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="physicalCondition" lay-skin="primary"   th:each="c:${reportDict['physical_condition']}" th:value="${c.dictKey}" th:title="${c.dictValue}"  >
                                    </div>

                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">近期动向</label>
                                    <div class="layui-input-block">
                                        <input type="radio" th:field="${sysReport.travel}" name="travel" th:each="c:${reportDict['travel']}" th:value="${c.dictKey}" th:title="${c.dictValue}" >
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        最近一个月是否有国外/省外旅游史
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_email" class="layui-form-label">
                                        <!--<span class="x-red">*</span>-->近期行程描述
                                    </label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="L_email" th:value="${sysReport.travelDescription}" name="travelDescription" required="" lay-verify="test" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">
                                        情况描述（无相关症状者选填）
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_email" class="layui-form-label">
                                    </label>
                                    <button  class="layui-btn" lay-filter="add" lay-submit="">
                                        增加
                                    </button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
        layui.use(['form','layer', 'laydate'], async function(){
            $ = layui.jquery;
            let form = layui.form
                ,layer = layui.layer
                ,laydate = layui.laydate;

            //监听提交
            form.on('submit(add)', function(data){
                var arr_box = [];
                $('input[type=checkbox]:checked').each(function() {
                    arr_box.push($(this).val());
                });
                //数组
                data.field["physicalCondition"] = arr_box.join(",")
                console.log("data ...", data)
                // ajax 传输数据
                $.ajax({
                    url:"/report/add",
                    type:"POST",
                    contentType: "application/json; charset=utf-8",
                    data:JSON.stringify(data.field),
                    dataType:'json',
                    success:function(result){
                        layer.alert("添加成功", {icon: 6},function (index1) {
                            layer.close(index1);
                            location.reload()
                        });
                    }
                });
                return false;
            });
        });
    </script>

</html>